home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / telecomm / sticpsrc.lzh / SOURCE.ARC / AX25.H < prev    next >
C/C++ Source or Header  |  1990-01-01  |  4KB  |  102 lines

  1. /* AX.25 datagram (address) sub-layer definitions */
  2.  
  3. /* Maximum number of digipeaters */
  4. #define MAXDIGIS    8    /* 8 digipeaters plus src/dest */
  5. #define ALEN        6    /* Number of chars in callsign field */
  6. #define AXALEN        7    /* Total AX.25 address length, including SSID */
  7.  
  8. /* Internal representation of an AX.25 address */
  9. struct ax25_addr {
  10.     char call[ALEN];
  11.     char ssid;
  12. #define SSID        0x1e    /* Sub station ID */
  13. #define REPEATED    0x80    /* Has-been-repeated bit in repeater field */
  14. #define E        0x01    /* Address extension bit */
  15. #define C        0x80    /* Command/response designation */
  16. };
  17. #define NULLAXADDR    (struct ax25_addr *)0
  18.  
  19. /* Internal representation of an AX.25 header */
  20. struct ax25 {
  21.     struct ax25_addr dest;            /* Destination address */
  22.     struct ax25_addr source;        /* Source address */
  23.     struct ax25_addr digis[MAXDIGIS];    /* Digi string */
  24.     int ndigis;                /* Number of digipeaters */
  25.     int cmdrsp;                /* Command/response */
  26. };
  27.  
  28. /* Per-call control block
  29.  * These are indexed through 3 hash tables.
  30.  * One table contains entries for each callsign capable of digipeating,
  31.  * the second table contains entries each connectable callsign + the broadcast
  32.  * addresses for IP and ARP (QST-0) and NET/ROM (NODES-0).  The third table
  33.  * contains AX25 callsigns to be excluded from connects and digipeats.
  34.  *
  35.  * When it is a connectable callsing with a port number, initial upcall handlers
  36.  * will also be stored by the server on this port.
  37.  * The tables are used in ax_recv().
  38.  */
  39. struct ax25_call {
  40.     struct ax25_call *next;        /* Doubly linked list pointers */
  41.     struct ax25_call *prev;
  42.  
  43.     struct ax25_call *p_next;    /* Doubly linked list of port numbers */
  44.     struct ax25_call *p_prev;
  45.  
  46.     struct ax25_addr addr;        /* Callsign */
  47.     struct interface *interface;    /* Associated interface */
  48.     int    port;            /* AX25 port number (when connectable) */
  49. /* fixed port numbers for ax.25 servers */
  50.  
  51. #define TNCPORT        1        /* interactive AX25 connection port */
  52. #define NETDIGIPORT    2        /* intelligent digipeater */
  53. #define MHEARDPORT    3        /* show MHEARD list */
  54. #define BRIDGEPORT    4        /* conference bridge */
  55. #define TNC2PORT    5        /* TNC2 emulator */
  56. #define MBOXPORT    6        /* mini mailbox */
  57.  
  58.     int    mode;            /* Operation mode for this callsign */
  59. #define IP_ARP_CON    0        /* Normal callsign for interface */
  60. #define CONNECT        1        /* AX25 connected mode */
  61. #define DIGIPEAT    2        /* Standard digipeater, or gateway */
  62. #define DIGICONNECT    3        /* Digipeater simulating a connect */
  63.  
  64.     int    flags;            /* Capability and Permission flags */
  65. #define MULTICAST    0x01        /* Set if this entry is the multicast addr */
  66. #define MULTI_IF    0x02        /* Set if callsign valid on all interfaces */
  67. #define DIGIGATEWAY    0x04        /* Set if digipeater is a gateway */
  68. #define IP_ARP_MULTI    0x10        /* when MULTICAST, this is QST-0 */
  69. #define NETROM_MULTI    0x20        /* when MULTICAST, this is NODES-0 */
  70.  
  71.     void    (*r_upcall)();        /* Receiver upcall */
  72.     void    (*t_upcall)();        /* Transmit upcall */
  73.     void    (*s_upcall)();        /* State change upcall */
  74.     char    *user;            /* User pointer */
  75. };
  76. #define NULLAXCALL    (struct ax25_call *)0
  77. extern struct ax25_call *ax25_digi[];
  78. extern struct ax25_call *ax25_call[];
  79. extern struct ax25_call *ax25_excl[];
  80. extern struct ax25_call *ax25_port;
  81. extern struct ax25_call *cr_axcall(),*find_axcall();
  82.  
  83. /* C-bit stuff */
  84. #define UNKNOWN        0
  85. #define COMMAND        1
  86. #define RESPONSE    2
  87.  
  88. /* Bit fields in AX.25 Level 3 Protocol IDs (PIDs)
  89.  * The high order two bits control multi-frame messages.
  90.  * The lower 6 bits is the actual PID. Single-frame messages are
  91.  * sent with both the FIRST and LAST bits set, so that the resulting PIDs
  92.  * are compatible with older code.
  93.  */
  94. #define PID_FIRST    0x80    /* Frame is first in a message */
  95. #define PID_LAST    0x40    /* Frame is last in a message */
  96. #define PID_PID        0x3f    /* Protocol ID subfield */
  97.  
  98. #define PID_IP        0x0c    /* ARPA Internet Protocol */
  99. #define PID_ARP        0x0d    /* ARPA Address Resolution Protocol */
  100. #define PID_NETROM    0x0f    /* NET/ROM */
  101. #define PID_NO_L3    0x30    /* No level 3 protocol */
  102.